Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve robustness of the simple runscript #1307

Merged
merged 2 commits into from
Apr 14, 2021
Merged

Conversation

sakogan
Copy link
Contributor

@sakogan sakogan commented Apr 13, 2021

Running the simple runscript with a task that does not have datasets for all the three phases (train/test/val) results in error. E.g., the following command:

python jiant/proj/simple/runscript.py run --run_name simple --exp_dir ${EXP_DIR}/ --data_dir ${EXP_DIR}/tasks --hf_pretrained_model_name_or_path roberta-base --tasks squad_v1 --train_batch_size 16 --num_train_epochs 3

results in the following error:

File "jiant/proj/simple/runscript.py", line 267, in <module>
    main()
  File "jiant/proj/simple/runscript.py", line 259, in main
    run_simple(args, with_continue=False)
  File "jiant/proj/simple/runscript.py", line 151, in run_simple
    tokenize_and_cache.main(
  File "jiant/proj/main/tokenize_and_cache.py", line 203, in main
    examples=task.get_test_examples(),
  File "jiant/tasks/lib/templates/squad_style/core.py", line 397, in get_test_examples
    return self.read_squad_examples(path=self.test_path, set_type=PHASE.TEST)
  File "jiant/tasks/core.py", line 150, in test_path
    return self.path_dict["test"]
KeyError: 'test'

This fix reads the config file of the given task and skips phases not specified in that config.

Skip task phases (e.g., "test") not specified in the config of a task (e.g., "squad_v1")
@codecov
Copy link

codecov bot commented Apr 13, 2021

Codecov Report

Merging #1307 (bd488a8) into master (65888b4) will decrease coverage by 0.00%.
The diff coverage is 20.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1307      +/-   ##
==========================================
- Coverage   48.47%   48.46%   -0.01%     
==========================================
  Files         163      163              
  Lines       11216    11220       +4     
==========================================
+ Hits         5437     5438       +1     
- Misses       5779     5782       +3     
Impacted Files Coverage Δ
jiant/proj/simple/runscript.py 44.53% <20.00%> (-0.64%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65888b4...bd488a8. Read the comment docs.

Copy link
Collaborator

@jeswan jeswan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sakogan! Just ran into this issue so this was great timing.

@jeswan jeswan merged commit f796e5a into nyu-mll:master Apr 14, 2021
@sakogan
Copy link
Contributor Author

sakogan commented Apr 14, 2021

No problem! You may also want to update the Bash example in the Quick Introduction of the Readme to use "hf_pretrained_model_name_or_path" instead of "model_type".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants